const u = navigator.userAgent;
const isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1;
const isIOS = u.indexOf('iPhone') > -1 || u.indexOf('iPad') > -1;

let userInfo
let userOrgIds
let QINIUPATH
let platformCode
let IS_OFFLINE_MODULE
let appKeyObj
let unit_search_records

try {
  // 离线巡检不能使用window.top，会跨域
  userInfo = window.top.userInfor || {}
  userOrgIds = userInfo.isMuilUnitUser ? userInfo.organizationIds : userInfo.org.id
  QINIUPATH = window.top.QINIUPATH
  platformCode = window.top.platformCode
  IS_OFFLINE_MODULE = window.top.native.getDataByKey('IS_OFFLINE_MODULE') == 1
  appKeyObj = window.top.appKeyObj
  unit_search_records = JSON.parse(window.top.native.getDataByKey('unit_search_records') || '{}')
  window.uploadOnNginx = window.top.uploadOnNginx
} catch (error) {

}

export default {
  // 用户信息
  userInfo: userInfo,
  userOrgIds: userOrgIds,
  // 设备信息
  appKeyObj: appKeyObj,
  // 最近访问单位
  unitRecords: unit_search_records,
  //平台编码
  platformCode: platformCode,
  isRenovate: false, // 是否刷新头部
  isShowInspection: false, // 是否显示隐藏巡检点位
  isAndroid,
  isIOS,
  qiniuPath: QINIUPATH,
  curInspectTaskId: '',
  isOffline: IS_OFFLINE_MODULE,
  carrerTouScroll: 0,
}
